package root.electronclass.electronclass.widget

import android.app.Activity
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.fragment.app.FragmentActivity
import root.electronclass.electronclass.databinding.LayoutBackBinding

class BackWidget @kotlin.jvm.JvmOverloads constructor(
    context: Context,
    attributeSet: AttributeSet? = null,
    defStyle: Int = 0
) : ConstraintLayout(context, attributeSet, defStyle) {

    private val binding: LayoutBackBinding =
        LayoutBackBinding.inflate(LayoutInflater.from(context), this, true)

    init {
        binding.back.setOnClickListener {
            (context as? FragmentActivity)?.finish()
        }

    }

}